<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>56.可选链操作符</title>
</head>
<body>
<script>
  function f1(config) {
    // let host = config && config.db && config.db.host;
    // let host =  config.db.host;
    let host =  config?.db?.host;
    console.log(host)
  }

  f1()
  f1({
    db:{
      host: "127.0.0.1",
      port:8000
    },
    title:{
      name:"zzl"
    }
  })
</script>
</body>
</html>